<?
require_once("include.php");

$me=false;
require_once("header.session.php");
require_once("header.gui.php");
require_once("header.misc.php");
require_once("header.habits.php");

//globals
$MenuObjects= $me->getMyMenu();

if(!$me) {
	$me=&new Person($_SESSION['id']);
}

if(isset($_POST['action'])) {
	switch($_POST['action']) {
		default:
			header("Location: " . $_SERVER['PHP_SELF']);
			die;
	}
}

if(!isset($_GET['page'])) {
	$_GET['page']="default";
}

function headers() {
	
}

function Body() {
	switch($_GET['page']) {
		case "view":
			require_once("checklists_view.php");
			break;
		case "edit":
			require_once("checklists_edit.php");
			break;
		default:
if($me->isInGroup("Administrator")) {
  echo "<br />Here you may edit the contents of the checklists. <b><i><u>DO NOT EDIT THE CHECKLISTS UNLESS YOU KNOW WHAT YOU ARE DOING.</b></i></u> Incorrect editing of checklist items could (easily) result in many students losing credit for what they have already done, and editing is unreversable... This is really serious.";
} else {
die;
}


		echo "
	<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"post\">
	<select name=\"checklist\">
	
	<option value=\"-1\">--Select A Checklist</option>
	";
	$checklists=getChecklistList();
	foreach($checklists as $check) {
		echo "
		<option value=\"" . $check['checklist_id'] . "\">" . stripslashes($check['checklist_name']) . "</option>";
	}
	echo "
	<input type=\"submit\" name=\"action\" value=\"Edit\">
	<br>
	</form>
	<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"post\">
	<input type=\"submit\" name=\"action\" value=\"new\">
	";
			break;
	}
}


include("template.php");

